#include "comm.h"
#include <unistd.h>
int main(){
  key_t key = ftok(PATH_NAME, PROJ_ID);
  if(key < 0){
    perror("ftok");
    return 1;
  }

  int shmId = shmget(key, SIZE,IPC_CREAT | IPC_EXCL | 0666);//创建全新的shm，如果和系统已经存在ID冲突，就出错返回
  if(shmId < 0){
    perror("shmget");
    return 2;
  }
  printf("key->%d, shmId->%d\n", key, shmId);
  sleep(10);

  shmctl(shmId, IPC_RMID, NULL);
  
  printf("key->%d, shmId->%d   shm delete success\n", key, shmId);
  sleep(10);

  return 0;
}
